<div class="row-content am-cf">
    <div class="row">
        <div class="am-u-sm-12 am-u-md-12 am-u-lg-12">
            <div class="widget am-cf">
                <form id="my-form" class="am-form tpl-form-line-form" enctype="multipart/form-data" method="post">
                    <div class="widget-body">
                        <fieldset>
                            <div class="widget-head am-cf">
                                <div class="widget-title am-fl">分红设置</div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">分红状态 </label>
                                <div class="am-u-sm-9 am-u-end">
                                    <label class="am-radio-inline">
                                        <input type="radio" name="model[status]" value="1" data-am-ucheck <?= $values['status'] == '1' ? 'checked' : '' ?>
                                        >
                                        开启
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" name="model[status]" value="2" data-am-ucheck <?= $values['status'] == '2' ? 'checked' : '' ?>
                                        >
                                        关闭
                                    </label>
                                </div>
                            </div>
                            <div class="am-form-group am-padding-top">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require"> 开始时间 </label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end" onclick="time()" >

                                    <input type="text" class="j-laydate-start am-form-field"
                                           name="model[start_time]"
                                           placeholder="开始时间"
                                           value="<?= $values['start_time'] ?>"  required readonly>
                                    <div class="help-block">
                                        <small style="color: red;font-size: 15px;font-weight: 700">请注意：时间修改后将会开启新的活动，微股东将不再分红，请谨慎操作！</small>
                                    </div>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">分红周期 </label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <div class="am-input-group">
                                        <input type="number" name="model[term]" onkeyup="clearNoNum(this)" value="<?= $values['term'] ?>"
                                               class="am-form-field am-field-valid" required>
                                        <span class="widget-dealer__unit am-input-group-label am-input-group-label__right">天</span>
                                    </div>
                                    <small>分红期限为1-180,如：100</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">分红条件 </label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <div class="am-input-group">
                                        <input type="number" name="model[money]" value="<?= $values['money'] ?>"
                                               class="am-form-field am-field-valid" onkeyup="clearNoNum(this)" required>
                                        <span class="widget-dealer__unit am-input-group-label am-input-group-label__right">元</span>
                                    </div>
                                    <small>最多保留两位小数,如：300</small>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">分红上限 </label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <div class="am-input-group">
                                        <input type="number" name="model[upline]" onkeyup="this.value=this.value.replace(/\D/g,'')" value="<?= $values['upline'] ?>"
                                               class="am-form-field am-field-valid" required>
                                        <span class="widget-dealer__unit am-input-group-label am-input-group-label__right">%</span>
                                    </div>
                                    <small>分红上限不能超过100,如：80</small>
                                </div>
                            </div>

                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">分红拨比 </label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <div class="am-input-group">
                                        <input type="number" name="model[rewardpercent]" value="<?= $values['rewardpercent'] ?>"
                                               class="am-form-field am-field-valid" onkeyup="clearNoNum(this)" required>
                                        <span class="widget-dealer__unit am-input-group-label am-input-group-label__right">%</span>
                                    </div>
                                    <small>分红拨比范围为3~50,如：10</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">实物商品参与分红</label>
                                <div class="am-u-sm-9 am-u-end">
                                    <label class="am-radio-inline">
                                        <input type="radio" name="model[real_reward]" value="0" data-am-ucheck <?= $values['real_reward'] == '0' ? 'checked' : '' ?>
                                        >
                                        否
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" name="model[real_reward]" value="1" data-am-ucheck <?= $values['real_reward'] == '1' ? 'checked' : '' ?>
                                        >
                                        是
                                    </label>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">零钱抵扣开关</label>
                                <div class="am-u-sm-9 am-u-end">
                                    <label class="am-radio-inline">
                                        <input type="radio" name="model[moneypercentstatus]" value="1" data-am-ucheck <?= $values['moneypercentstatus'] == '1' ? 'checked' : '' ?>
                                              >
                                        开启
                                    </label>
                                    <label class="am-radio-inline">
                                        <input type="radio" name="model[moneypercentstatus]" value="2" data-am-ucheck <?= $values['moneypercentstatus'] == '2' ? 'checked' : '' ?>
                                              >
                                        关闭
                                    </label>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">零钱抵扣比例 </label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <div class="am-input-group">
                                        <input type="number" name="model[moneypercent]" value="<?= $values['moneypercent'] ?>"
                                               class="am-form-field am-field-valid" onkeyup="clearNoNum(this)" required>
                                        <span class="widget-dealer__unit am-input-group-label am-input-group-label__right">%</span>
                                    </div>
                                    <small>请输入正整数,如：10</small>
                                </div>
                            </div>
                            <div class="am-form-group">
                                <label class="am-u-sm-3 am-u-lg-2 am-form-label form-require">期数 </label>
                                <div class="am-u-sm-9 am-u-md-6 am-u-lg-5 am-u-end">
                                    <div class="am-input-group">
                                        <input type="number"  "
                                               class="am-form-field am-field-valid" value="<?= $values['periods_num'] ?>" readonly>
                                        <span class="widget-dealer__unit am-input-group-label am-input-group-label__right">期</span>
                                    </div>
                                </div>
                            </div>


                            <div class="am-form-group">
                                <div class="am-u-sm-9 am-u-sm-push-3 am-margin-top-lg">
                                    <button type="submit" class="j-submit am-btn am-btn-secondary">提交
                                    </button>
                                </div>
                            </div>
                        </fieldset>
                    </div>
                </form>
            </div>
        </div>
    </div>
</div>
<script src="assets/common/plugins/laydate/laydate.js"></script>
<script src="assets/store/js/select.data.js?v=<?= $version ?>"></script>
<script>
    $(function () {
        // 时间选择器
        laydate.render({
            elem: '.j-laydate-start'
            , type: 'datetime' 
        });
        /**
         * 表单验证提交
         * @type {*}
         */
        $('#my-form').superForm();
    });

    function time(){
        
    }



    function clearNoNum(obj){
        obj.value = obj.value.replace(/[^\d.]/g,"");  //清除“数字”和“.”以外的字符
        obj.value = obj.value.replace(/^\./g,"");  //验证第一个字符是数字而不是.
        obj.value = obj.value.replace(/\.{2,}/g,"."); //只保留第一个. 清除多余的.
        obj.value = obj.value.replace(".","$#$").replace(/\./g,"").replace("$#$",".");
    }
</script>
